<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
  <meta name="viewport" content="width=device-width,initial-scale=1.0,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" /> 
  <meta name="format-detection" content="telephone=no">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/css/index.css">
  <script type="text/javascript" src="__PUBLIC__/js/jquery-1.7.2.min.js"></script>
  <script type="text/javascript" src="__PUBLIC__/js/wapupimg.js"></script>
  <title>宠物防丢器</title>
</head>
<body class="body_in">

<div class="use_z_index">
</div>
<div class="uploadInfo">
  <div class="uploadInfo_img"><img src="__PUBLIC__/img/loading.gif"  width="50" /></div>
  <div class="uploadInfo_font">数据上传中请耐心等待......</div>
</div>


<div  class="in_one">

<div class="use_top"><span class="re_hui"><<返回</span>  信息录入</div>
   <div class="use_top_content">
   <div class="use_top_content_in">录入时间:</div>
   <div class="content_info content_info_time"><input type="date" id="write_info" value="{$write_info.w_wtime}"/></div>
   </div>

 <div class="clear"></div>

   <div class="use_top_content">
   <div class="use_top_content_in">详细内容:</div>
   <div class="content_info content_info_write"><textarea id="textarea_content" placeholder="请录入免疫 , 治疗等信息。">{$write_info.w_content}</textarea></div>
   </div>
<div class="clear"></div>

<if condition="$w_id eq ''"> <!-- 添加 -->

<div class="use_top_content_in">添加图片:</div>
 <div class="imgupshow">
           <input id="testFile" type="file"   multiple="multiple"/>
           <div class="imgs">

           <div class="imgindex">
            <img class="testImg lastupimg" src="/public/img/1add.png" />  
            </div>

           </div>
</div>

  
<else/> <!-- 修改 -->

 <div class="imgupshow">
          <volist name="w_pic" id="vo">
            <div class="imgindex">
            <img class="testImg lastupimg" src="{$vo}" />  
            </div>
          </volist>
</div>

</if>
<script type="text/javascript">
  $('.lastupimg').live('click',function(){
    $('#testFile').click();
  })


  $('.close_img').live('click',function(){
    $(this).parent().hide();
  })
</script>

<style type="text/css">
   .imgindex{float:left;position:relative;}
  .index{width:102px;height:102px;position:absolute;top:0px;left:6px;}
  .closeimg{height: 30px;width: 30px; }
  .testImg{width: 60px; height: 60px; border:5px dashed #ADADAD;  margin-left: 20px; margin-top: 20px; margin-right: 5px;}
  #testFile{opacity: 0; }
  .fabuinfo{width: 80%; height: 40px;line-height: 40px; text-align: center; background-color:#FF4500; margin: 0px auto; margin-top: 30px; border-radius: 20px; color: #FFFFFF;}
  .fabuinfo1{width: 100%;text-align: center; padding-bottom: 30px;}
  .close_img{position: absolute; left:80px; top:10px;}

    .delete{
    position: absolute;
    margin-top:250px;
    z-index: 10px;
    color: #ffffff;
    background-color:#ADADAD;
    opacity: 0.5;
    width: 25%; 
    text-align: center;
    background-color:#FF5151; 
 }
 </style>
 <div class="clear"></div>
<if condition="$write_info.w_id eq ''">
<div class="add_info">确认添加</div>
<else/>
<div class="save_info">确认修改</div>
</if>
<script type="text/javascript">
  $('.add_info').click(function(){
    $('.use_z_index').show();
    $('.uploadInfo').show();
   var write_time= $('#write_info').val();
   var textarea_content= $('#textarea_content').val();
   var imgs=[];
      $('.testImg').each(function(i){ 
          imgs[i]=$(this).attr('src');
        });
   $.post("{:U('Index/addpetinfo')}",{w_type:1,imgs:imgs,write_time:write_time,textarea_content:textarea_content},function(date){
      if(date==100){
        alert('添加成功');
        $('.use_z_index').hide();
        $('.uploadInfo').hide();
        location.href="{:U('Index/index')}"
      }else{
        alert('添加失败');
      }
   })
  })
  $('.re_hui').click(function(){
    history.go(-1);
  })
</script>

<script type="text/javascript">
  $('.save_info').click(function(){
   var w_id=<?php echo $w_id;  php?>;
   var write_time= $('#write_info').val();
   var textarea_content= $('#textarea_content').val();
   $('.use_z_index').show();
   $('.uploadInfo').show();
   $.post("{:U('Index/addpetinfo')}",{w_id:w_id,save:1,write_time:write_time,textarea_content:textarea_content},function(date){
      if(date==100){
        alert('修改成功');
        $('.use_z_index').hide();
        $('.uploadInfo').hide();
        location.href="{:U('Index/petInfo')}"
      }else{
        alert('修改失败');
      }
   })
  })
  $('.re_hui').click(function(){
    history.go(-1);
  })
</script>
</body>
</html>